// import {createStore} from 'redux'
import { createSlice,configureStore } from "@reduxjs/toolkit";
import logger from "redux-logger";
const counterSlice = createSlice({
  name:"counter",
  initialState:{num:1},
  reducers:{
    decrement: state => {state.num-=1},
    increment: (state,action) => {state.num+=action.payload},
  }
})
const store = configureStore({
  reducer:{
    counter:counterSlice.reducer
   },
   middleware:[logger]
})
export default store
export type RootState = ReturnType<typeof store.getState>
export type AppAction = typeof store.dispatch
export const {decrement,increment} = counterSlice.actions